package org.example.domain.activity.service.trial.thread;

import org.example.domain.activity.adapter.repository.IActivityRepository;
import org.example.domain.activity.model.valobj.GroupBuyActivityDiscountVO;
import org.example.domain.activity.model.valobj.SCSkuActivityVO;

import java.util.concurrent.Callable;

public class QueryGroupBuyActivityDiscountVOThreadTask implements Callable<GroupBuyActivityDiscountVO> {


private final IActivityRepository activityRepository;


private final String source;
private final String channel;

private final String goodsId;

    public QueryGroupBuyActivityDiscountVOThreadTask(String source, String channel,String goodsId,IActivityRepository activityRepository) {
        this.activityRepository = activityRepository;
        this.source = source;
        this.channel = channel;
        this.goodsId=goodsId;
    }


    @Override
    public GroupBuyActivityDiscountVO call() throws Exception {
       SCSkuActivityVO scSkuActivityVO= activityRepository.querySCSkuActivityBySCGoodsId(source,channel,goodsId);
if(scSkuActivityVO==null)
{
    return null;
}

        return activityRepository.queryGroupBuyActivityDiscountVO(scSkuActivityVO.getActivityId());
    }
}
